package com.zhuang.chapter10.work01;

import java.util.Scanner;

public class PriceTest {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			System.out.println("请输入数据：");
			try {
				double price = Double.parseDouble(sc.nextLine());
				if (price > 0) {
					System.out.println("价格为：" + price);
					break;
				} else if (price < 0) {
					System.out.println("价格不能为负！重新输入！");
				}
			} catch (Exception e) {
				System.out.println("输入的数据有问题！重新输入！");
			}
		}
	}
}
